package com.twt.survey.exception;

import com.twt.survey.common.BaseResponse;
import com.twt.survey.common.ErrorCode;
import com.twt.survey.utils.ResultUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@Slf4j
@RestControllerAdvice("com.twt.survey.controller")
public class GlobalExceptionHandler {
    @ExceptionHandler(IllegalStateException.class)
    public BaseResponse<Object> checkNull(IllegalStateException e){
        log.error("IllegalStateException: " + e.getMessage(), e);
        return ResultUtils.fail(ErrorCode.UNFINISHED_STATUS, "尚未完成填写");
    }

}
